
      
<div id="sub-menu">	
	<%= image_tag "trash.png", :id=>'trash', :onMouseOut=>"empty_trash()" %> <br /> <br />
	<%= link_to image_tag ("computer-add.png"), new_machine_path %> <br /> <br />
	<%= link_to image_tag ("add_room.png"), new_room_path %>

</div> 
<div id="centre">
	<div id="left">
		<% for room in @views %>
			<% room_id = "room_#{room.id}" %>
			<div id="windows-title"><span style="position: relative;"><%= room.room_name %> <span style="position: relative; top: 6px;"><%= link_to image_tag ("monitor_add.png"), "/machines/new_from_view/"+String(room.id) %> </span></span>
			     <div id="button-windows">
			     	<%= image_tag "reduce.png",:onclick => "Effect.SlideUp('#{room_id}'); return false;"%>
			     	<%= image_tag "enlarge.png",:onclick => "Effect.SlideDown('#{room_id}'); return false;"%> 
			     </div>
			</div>
			<div class="room" id=<%= room_id %> > 
						<%= drop_receiving_element (room_id ,                            
				  		:accept => "machine",                                       
				 		:with   => "'machine=' + (element.id.split('_').last()) + '&room=' + #{room.id}",   
				  	    :url    => {:action=>:change_room},                   
				  	    :confirm => "Voulez-vous ajouter l'ordinateur à la salle ?")
				  		%>
				<% for machine in room.machines %>
				<% m_id = "#{machine.id}" %>
					<div class="machine" id=<%= m_id %> >
						<table class="table1">
						<td><img src='images/computer1.png'><br /><%= machine.machine_name %></td>
						<td><%= machine.ip_adr %></td>
						<td><%= link_to image_tag("preview.png"), machine %></td>
						<td><%= link_to image_tag("reseau.png"),"/monitorings/ping_machine_manuel/"+String(m_id) %></td>
						<td><%= link_to image_tag("delete.png"), "/views/destroy_by_view/"+String(m_id), :confirm => 'Confirmer Suppression?'%></td>
						<% for inc in @incident %>
							<% m_inc = "#{inc.machine_id}" %>
							<% if m_inc == m_id %>
								<td><%= link_to image_tag("warning.png"), {:controller => "machines", :action => "incidentlist", :id => m_id} %></td>
							<% end %>
						<% end %>
						
						</table>
						<br />	
					</div>	
					<%= draggable_element(m_id, :revert=>true) %>	
				<% end %>
			</div>
		
		<% end %>
	</div>
		
		
	<div id="right">
		<% for room_zero in @views0 %>
			<% room_id = "room_#{room_zero.id}" %>
			<div id="windows-title"><span style="position: relative; "><%= room_zero.room_name%></span>
				<div id="button-windows">
			     	<%= image_tag "reduce.png",:onclick => "Effect.SlideUp('#{room_id}'); return false;"%>
			     	<%= image_tag "enlarge.png",:onclick => "Effect.SlideDown('#{room_id}'); return false;"%> 
			     </div>
			</div>
			<div class="room" id=<%= room_id %> > 
					<%= drop_receiving_element (room_id ,                            
				  		:accept => "machine",                                       
				 		:with   => "'machine=' + (element.id.split('_').last()) + '&room=' + #{room_zero.id}",   
				  	    :url    => {:action=>:change_room},                   
				  	    :confirm => "Voulez-vous ajouter l'ordinateur à la salle ?")
				  		%>
				<% for machine_zero in room_zero.machines %>
					<% m_id = "#{machine_zero.id}" %>
					<div class="machine" id=<%= m_id %> >
						<table class="table1">
						<td><img src='images/computer1.png'><br /><%= machine_zero.machine_name %></td>
           				<td><%= machine_zero.ip_adr %></td>
           				<td><%= link_to image_tag("preview.png"), machine %></td>
           				<td><%= link_to image_tag("reseau.png"),"/monitorings/ping_machine_manuel/"+String(m_id) %></td>
           				<td><%= link_to image_tag("delete.png"), "/views/destroy_by_view/"+String(m_id), :confirm => 'Confirmer Suppression?'%></td>
           					<% for inc in @incident %>
							<% m_inc = "#{inc.machine_id}" %>
							<% if m_inc == m_id %>
								<td><%= link_to image_tag("warning.png"), {:controller => "machines", :action => "incidentlist", :id => m_id} %></td>
							<% end %>
						<% end %>
           				</table>
           				<br />
					</div>
					<%= draggable_element(m_id, :revert=>true) %>	
				<% end %>		
			</div>		
		<% end %>			  
	</div>
	

	<%= drop_receiving_element('trash',                              # L'id de l'élément reçu
  		:accept => "machine",                                        # The CSS class of the dropped element
 		:with   => "'machine=' + (element.id.split('_').last())",   # The query string parameters
  	    :url    => {:action=>:trash_machine},                         # The action to call
  	    :confirm => "Voulez-vous supprimer l'ordinateur ?",
  	    :onHover => "function() {fill_trash()}"
)%>		

</div>
<script>    
    function fill_trash() {
        $('trash').src = "/images/trashfull.png";
    }       
  
    function empty_trash() {
        $('trash').src = "/images/trash.png";
    }     
</script>


